<template>
  <div>
    <a-card :bordered="false" style="width:100%;background: #ffffff;">
      <a-layout>
        <a-layout>
          <a-layout-sider width="50%" style="background-color: #ffffff;">
            <a-form :label-col="{ span: 6 }" :wrapper-col="{ span: 12 }">
              <a-form-item label="用户id">
                <div>{{userId}}</div>
              </a-form-item>
              <a-form-item label="数据类型" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.dtype"/>
              </a-form-item>
              <a-form-item label="舵偏角" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.angleDeflectionFlaps"/>
              </a-form-item>
              <a-form-item label="侧滑角(°)" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.beta"/>
              </a-form-item>
              <a-form-item label="参考展长" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.bref"/>
              </a-form-item>
              <a-form-item label="坐标系系统" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.coordinateSystem"/>
              </a-form-item>
              <a-form-item label="坐标系" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.coordinate"/>
              </a-form-item>
              <a-form-item label="副翼舵偏角" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.da"/>
              </a-form-item>
              <a-form-item label="升降舵偏角" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.de"/>
              </a-form-item>
              <a-form-item label="方向舵偏角" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.dr"/>
              </a-form-item>
              <a-form-item label="油气化学恰当比" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.fst"/>
              </a-form-item>
              <a-form-item label="来流比热比" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.gamma"/>
              </a-form-item>

            </a-form>

          </a-layout-sider>

          <a-layout-content style="background-color: #ffffff;">
            <a-form :label-col="{ span: 6 }" :wrapper-col="{ span: 12 }"> 
              <a-form-item label="马赫数" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.ma"/>
              </a-form-item>
              <a-form-item label="来流静压" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.p"/>
              </a-form-item>
              <a-form-item label="油气比" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.ph"/>
              </a-form-item>
              <a-form-item label="动压(pa)" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.q"/>
              </a-form-item>
              <a-form-item label="来流总压" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.pt"/>
              </a-form-item>
              <a-form-item label="雷诺数" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.re"/>
              </a-form-item>
              <a-form-item label="参考面积" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.sref"/>
              </a-form-item>
              <a-form-item label="来流静温" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.t"/>
              </a-form-item>
              <a-form-item label="来流总温" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.tt"/>
              </a-form-item>
              <a-form-item label="来流速度" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.u"/>
              </a-form-item>
              <a-form-item label="攻角(°)" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.alf"/>
              </a-form-item>
              <a-form-item label="参考长度" :rules="[{ required: true}]">
                <a-input v-model:value="submitAeroData.lref"/>
              </a-form-item>
              <a-form-item :wrapper-col="{ offset: 8, span: 16 }">
                <a-button type="primary" html-type="submit" @click="submit()">Submit</a-button>
              </a-form-item>
            </a-form>            
          </a-layout-content>

        </a-layout>
      </a-layout>
    
    
    </a-card>
  </div>
</template>

<script setup>
import { ref ,onMounted} from 'vue';
import axios from '../config/axios.ts'
import { message } from 'ant-design-vue';
import {useRouter,useRoute }from 'vue-router'

const route = useRoute();
const router = useRouter();

const userId = route.query.userId
const submitAeroData = ref({
  dtype:'',
  alf:'',
  angleDeflectionFlaps:'',
  beta:'',
  bref:'',
  coordinateSystem:'',
  coordinate:'',
  da:'',
  de:'',
  dr:'',
  fst:'',
  gamma:'',
  lref:'',
  ma:'',
  p:'',
  ph:'',
  q:'',
  pt:'',
  re:'',
  sref:'',
  t:'',
  tt:'',
  u:'',
  userId:userId,
})


//添加新的气动数据
const submit = ()=>{
  axios.post('/aero/add',submitAeroData.value)
}


</script>